package utility;
import java.util.*;

public class cardHelper {
	
	final static char INVALID = '\0';

    private static Map<Character, Integer> map;
    
    static{
        map = new LinkedHashMap<Character, Integer>(15,1);
        map.put('3',1);
        map.put('4',2);
        map.put('5',3);
        map.put('6',4);
        map.put('7',5);
        map.put('8',6);
        map.put('9',7);
        map.put('X',8);
        map.put('J',9);
        map.put('Q',10);
        map.put('K',11);
        map.put('A',12);
        map.put('2',13);
        map.put('B',14);
        map.put('R',15);
    }
    
    public static int value2priority(char value){
        return map.get(value);
    }
    
    public static char priority2value(int priority){
    	if(priority>=1 && priority<=15){
        	Set<Character> keys = map.keySet();
        	Character[] values = keys.toArray(new Character[0]);
        	return values[priority-1];
    	} else {
    		return INVALID;
    	}
        
    }	    
}
